package com.scpii.api.common.auth.token;

import java.io.Serializable;

import org.codehaus.jackson.annotate.JsonCreator;
import org.codehaus.jackson.annotate.JsonValue;

public class DefaultRefreshToken implements AuthRefreshToken, Serializable {

	private static final long serialVersionUID = 8349970621900575838L;

	private String value;

	@JsonCreator
	public DefaultRefreshToken(String value) {
		this.value = value;
	}

	@SuppressWarnings("unused")
	private DefaultRefreshToken() {
		this(null);
	}

	@JsonValue
	public String getValue() {
		return value;
	}

	@Override
	public String toString() {
		return getValue();
	}

	@Override
	public boolean equals(Object o) {
		if (this == o) {
			return true;
		}
		if (!(o instanceof DefaultRefreshToken)) {
			return false;
		}
		DefaultRefreshToken that = (DefaultRefreshToken) o;
		if (value != null ? !value.equals(that.value) : that.value != null) {
			return false;
		}
		return true;
	}

	@Override
	public int hashCode() {
		return value != null ? value.hashCode() : 0;
	}

}
